package com.wnxy.test;

import com.wnxy.mapper.BookMapper;
import com.wnxy.mapper.GoodsMapper;
import com.wnxy.pojo.Book;
import com.wnxy.pojo.Goods;
import com.wnxy.repository.BookRepository;
import com.wnxy.repository.GoodsRepository;
import com.wnxy.utils.JsoupUtils;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;

import java.util.List;
import java.util.UUID;

@SpringBootTest
public class App4_goods {
    @Autowired
    private GoodsMapper goodsMapper;

    @Test
    public void insert() throws Exception {
        List<Goods> list = JsoupUtils.parseJd("python");
        list.forEach(goods -> {
            goods.setId(UUID.randomUUID().toString().replaceAll("-",""));
            goodsMapper.insert(goods);
        });
    }

}
